<template>
  <div>
    <el-row class="row" :gutter="20">
      <el-col :span="21">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item :to="{ path: '/teacher' }">教师菜单</el-breadcrumb-item>
          <el-breadcrumb-item :to="{ path: '/teacher/comment' }">评阅管理</el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row>
    <el-table class="elTable" :data="commentInfoList" border stripe height="630" v-loading="loading">
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="comNo" label="评阅编号"></el-table-column>
      <el-table-column prop="choNo" label="选题编号"></el-table-column>
      <el-table-column prop="comScore" label="评阅分数">
        <template slot-scope="scope">
          <p style="color: #ff6767">{{scope.row.comScore}}</p>
        </template>
      </el-table-column>
      <el-table-column prop="comContent" label="评阅内容" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column prop="comStateDesc" label="评阅状态">
        <template slot-scope="scope">
          <p style="color: #ff6767">{{scope.row.comStateDesc}}</p>
        </template>
      </el-table-column>
      <el-table-column prop="gmtCreate" label="添加时间" sortable></el-table-column>
      <el-table-column prop="gmtModify" label="修改时间" sortable></el-table-column>
      <el-table-column label="操作" width="200px">
        <template slot-scope="scope">
          <el-button @click="detail(scope.row.comNo)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'TeacherComment',
  data () {
    return {
      loading: true,
      commentInfoList: []
    }
  },
  methods: {
    detail (comNo) {
      this.$router.push({ path: `/teacher/comment/${comNo}` })
    },
    listCommentInfo () {
      this.$axios.get('api/teacher/comment')
        .then(response => {
          let result = response.data
          if (result.success) {
            this.commentInfoList = result.data
            console.log('commentInfoList', this.commentInfoList)
          } else {
            this.$message.error(result.msg)
          }
          this.loading = false
        })
    }
  },
  mounted () {
    this.listCommentInfo()
  }
}
</script>

<style lang="stylus" scoped>
.row {
  margin: 20px;
}

.elTable >>> .cell {
  text-align: center;
}

.elTable {
  text-align: center;
}
</style>
